import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import i18n from './i18n'
// 初始化样式表
import '@/styles/index.scss'

import installIcons from '@/icons'

import './permission'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 国际化
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/lib/locale/lang/en'

import installFilter from '@/filters'
// 指令
import installDirective from '@/directives'

const app = createApp(App)
app.use(ElementPlus, {
  locale: store.getters.language === 'en' ? en : zhCn
})
installIcons(app)
installFilter(app)
installDirective(app)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(store).use(router).use(i18n).mount('#app')
